package com.victor.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.victor.dao.PicturePathDao;
import com.victor.entity.PicturePath;
import com.victor.service.PicturePathService;

@Service
public class PicturePathServiceImpl implements PicturePathService {

	@Autowired
	private PicturePathDao dao;

	@Override
	public boolean save(PicturePath p) {
		return dao.save(p) > 0 ? true : false;
	}

	@Override
	public boolean setPidToPath(int[] pathids, Integer pid) {
		return dao.setPidToPath(pathids, pid) > 0 ? true : false;
	}

	@Override
	public List<PicturePath> findByPid(Integer pid) {
		return dao.findByPid(pid);
	}

	@Override
	public boolean batchDelete(int[] ids) {
		if (ids != null && ids.length > 0) {
			return dao.batchDelete(ids) > 0 ? true : false;
		}
		return false;
	}

	@Override
	public boolean update(PicturePath p) {
		if (p == null) {
			return false;
		}
		return dao.update(p) > 0 ? true : false;
	}

}
